Answer:

The program will print:

The number of ounces is   48
The number of pounds is   3

Notice that using the variable POUNDS in the PRINT statement did not change its contents. The variable POUNDS is like a box that holds a value you can use as many times as you want without changing it.

Using the Contents of a Variable

The value stored in a variable can be used as many times as you want. Here is another program that uses a variable many times without changing the contents.

' 5280 feet per Mile
' 1 yard per 3 feet
' 12 inches per foot
'
LET MILE = 5
PRINT "Number of Miles", MILE
PRINT "Number of Yards", MILE * 5280 / 3
PRINT "Number of Feet",  MILE * 5280
PRINT "Number of Inches", MILE * 5280 * 12
PRINT "Number of Miles", MILE
END

The first statement finds memory for the variable MILE and puts the value 5 into it:

MILE
5

The 5 will stay in MILE until you change it (with a second LET statement, for instance). Using the variable in an arithmetic expression does not change it. The following statements will execute one after the other, in order. The program will print out:

Number of Miles     5
Number of Yards     8800
Number of Feet      26400
Number of Inches    316800
Number of Miles     5

Notice that the value 5 in MILE does not change, so the first PRINT statement and the last PRINT statement write the same thing to the monitor.

QUESTION 7:

What do you think the following program will write to the monitor?

' Hours of Boring Lectures
'
LET CLASSES = 4
PRINT "Hours per Week", CLASSES * 3
PRINT "Hours per Semester", CLASSES * 3 * 15
PRINT "Ho Hum..."
END